package com.zsx.shopping.common.api.ware.feign;

import com.zsx.shopping.common.api.R;
import com.zsx.shopping.common.api.ware.dto.LockStockDto;
import com.zsx.shopping.common.api.ware.vo.SkuStockVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient("shopping-ware")
public interface WareFeignService {

    @GetMapping("/ware/wareSkuStock/skuStock")
    R<Map<Long, SkuStockVO>> getSkuStock(@RequestParam("skuIds") List<Long> skuIds);

    @PutMapping("/ware/orderStockTask/lockStock")
    R<Void> lockStock(@RequestBody LockStockDto lockStockDto);

    @PutMapping("/ware/orderStockTask/reduceStock")
    R<Void> reduceStock(@RequestParam("orderId") Long orderId);
}
